package com.ruoyi.backend.mapper;

import com.ruoyi.backend.dto.EcologicalDataDTO;
import com.ruoyi.backend.pojo.EcologicalData;
import com.ruoyi.backend.vo.EcologicalDataVO;
import com.ruoyi.backend.vo.InversionResultVO;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import java.time.Instant;
import java.util.ArrayList;
import java.util.List;

@DataSource(value = DataSourceType.SLAVE)
@Mapper
@Component("BackendEcologicalMapper")
public interface EcologicalMapper {



    /**
     * @param mineId 矿山ID
     * @param startDate 开始时间
     * @param endDate 结束时间
     * @param status 状态
     * @param ecologicalId 生态数据ID
     * @return 反演结果数据列表
     */
    @DataSource(DataSourceType.SLAVE)
    List<InversionResultVO> getInversionResultData(@Param("mineId") String mineId,
                                                   @Param("startDate") Instant startDate,
                                                   @Param("endDate") Instant endDate,
                                                   @Param("status") Integer status,
                                                   @Param("ecologicalId") String ecologicalId
    );

    @DataSource(DataSourceType.SLAVE)
    boolean saveInversion(String fileName);

    ArrayList<EcologicalDataVO> selectEcologicalDataArragedByTime(@Param("mineId") String mineId, @Param("ecologicalCategory") String ecologicalCategory);

    void upload(EcologicalDataDTO ecologicalDataDTO);

    void update(EcologicalDataDTO ecologicalDataDTO);

    @Delete("delete from backend_inversion_result_data where id=#{id}")
    void delete(Long id);

    EcologicalData searchEcologicalDataInfoById(Long id);
}
